var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2gameBefore = require("gameBefore");
var $2Globe = require("Globe");
var $2NodeManager = require("NodeManager");
var $2ConstValue = require("ConstValue");
var $2GameUser = require("GameUser");
var $2EventCenter = require("EventCenter");
var $2EventDefine = require("EventDefine");
var $2AudioManager = require("AudioManager");
var $2UIManager = require("UIManager");
var $2Platformconf = require("Platformconf");
var $2BaseUIPopup = require("BaseUIPopup");
var $2UIPskin = require("UIPskin");
var $2UIPtili = require("UIPtili");
var $2UIVMain = require("UIVMain");
var Adv_skd=require("./Adv_skd")
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_UIPSetting = /* */function (_f$default) {
  function _ctor() {
    var _this119;
    babel_classCallCheck(this, _ctor);
    _this119 = _callSuper(this, _ctor, arguments);
    _this119.btnArrs = [];
    _this119.ndarr = [];
    _this119.btnList = null;
    return _this119;
  }
  babel_inherits(_ctor, _f$default);
  return babel_createClass(_ctor, [{
    key: "onShow",
    value: function onShow() {
      babel_get(babel_getPrototypeOf(_ctor.prototype), "onShow", this).call(this);
      $2ConstValue.ConstValue.IsGaming && $2NodeManager.default.Instance.openTiliView();
      this.changeBtns();
      $2Platformconf.default.PlatformType === $2Platformconf.ePlatformType.WXGame && cc.Canvas.instance.node.getComponent($2gameBefore.default).BannerShow();
      null != $2UIManager.UIManager.getInstance().getUI($2UIVMain.default) && $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).hideYXQ();
    }
  }, {
    key: "click",
    value: function click(e, t) {
      babel_get(babel_getPrototypeOf(_ctor.prototype), "click", this).call(this, e, t);
      if ("audio" == t) {
        if ($2GameUser.default.getInstance().bgm) {
          $2GameUser.default.getInstance().bgm = false;
          $2AudioManager.AudioManager.getInstance().stopAll();
        } else {
          $2GameUser.default.getInstance().bgm = true;
          $2AudioManager.AudioManager.getInstance().playBGM("bgm");
        }
        this.changeBtns();
      } else if ("sound" == t) {
        var _e64 = $2GameUser.default.getInstance().audio;
        $2GameUser.default.getInstance().audio = !_e64;
        this.changeBtns();
      } else if ("repaly" == t) {
        if ($2GameUser.default.getInstance().tili >= 1) {
          $2GameUser.default.getInstance().tili -= 1, $2EventCenter.default.postEvent($2EventDefine.default.GAME_TILI_INFO_UPDATE), $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).initGame(), $2Globe.default.getInstance().is_UIPsetting = false, this.close(), cc.Canvas.instance.node.getComponent($2gameBefore.default).BannerHide();
        } else {
          $2UIManager.UIManager.getInstance().showUI($2UIPtili.default);
        }
        cc.director.resume();
      } else if ("fangqi" == t) {
        $2Globe.default.getInstance().is_UIPsetting = false;

        Adv_skd.default.instance.hideGridAdLeftOne()
        Adv_skd.default.instance.hideGridAdRightOne()
        Adv_skd.default.instance.showGridAdLeftOne()
        Adv_skd.default.instance.showGridAdRightOne()

        this.close();
        $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).mapNode.removeAllChildren();
        $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).setContent(true);
        $2GameUser.default.getInstance().IsNewPlayer || $2UIManager.UIManager.getInstance().showUI($2UIPskin.default);
        $2GameUser.default.getInstance().IsNewPlayer = false;
        $2Platformconf.default.PlatformType === $2Platformconf.ePlatformType.WXGame && cc.Canvas.instance.node.getComponent($2gameBefore.default).BannerShow();
        cc.director.resume();
        $2ConstValue.ConstValue.IsGaming = false;
        $2NodeManager.default.Instance.openTiliView();
      } else if ("close" == t) {
        null != $2UIManager.UIManager.getInstance().getUI($2UIVMain.default) && $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).showYXQ(), $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).isHome || cc.Canvas.instance.node.getComponent($2gameBefore.default).BannerHide(), $2Globe.default.getInstance().is_UIPsetting = false, this.close(), cc.director.resume(), $2ConstValue.ConstValue.IsGaming && $2NodeManager.default.Instance.closeTiliView();
      }
    }
  }, {
    key: "changeBtns",
    value: function changeBtns() {
      for (var _o121 = 0; _o121 < this.btnArrs.length; _o121++) {
        this.btnArrs[_o121].parent.active = false;
      }
      this.btnArrs[0].parent.active = true;
      this.btnArrs[1].parent.active = true;
      var e = $2GameUser.default.getInstance().bgm;
      this.btnArrs[0].children[1].active = e;
      this.btnArrs[0].children[0].active = !e;
      var t = $2GameUser.default.getInstance().audio;
      this.btnArrs[1].children[1].active = t;
      this.btnArrs[1].children[0].active = !t;
      var n = $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).isHome;
      this.ndarr[0].active = !n;
      this.ndarr[1].active = !n;
      this.btnList.y = n ? 0 : 108;
    }
  }]);
}($2BaseUIPopup.default);
def_UIPSetting.className = "UIPSetting";
cc__decorate([ccp_property(Array(cc.Node))], def_UIPSetting.prototype, "btnArrs", undefined);
cc__decorate([ccp_property(Array(cc.Node))], def_UIPSetting.prototype, "ndarr", undefined);
cc__decorate([ccp_property(cc.Node)], def_UIPSetting.prototype, "btnList", undefined);
def_UIPSetting = cc__decorate([ccp_ccclass], def_UIPSetting);
exports.default = def_UIPSetting;